home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 1.0 / CIncludes / ctype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  2.4 KB  |  100 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     ctype.h
  4.     Character handling
  5.     
  6.     Copyright American Telephone & Telegraph
  7.     Used with permission, Apple Computer Inc.    1985-1990, 1992, 1994.
  8.     All Rights Reserved.
  9.  
  10. ************************************************************/
  11.  
  12.  
  13. #ifndef __CTYPE__
  14. #define __CTYPE__
  15.  
  16. /*       @(#)ctype.h        2.1  */
  17. /*       3.0 SID #         1.2      */
  18. #define _U         01
  19. #define _L         02
  20. #define _N         04
  21. #define _S         010
  22. #define _P         020
  23. #define _C         040
  24. #define _B         0100
  25. #define _X         0200
  26.  
  27. #ifdef __CFM68K__
  28.     #ifndef __SC__
  29.         #pragma push
  30.     #endif
  31.     #pragma lib_export on
  32. #endif
  33.  
  34. extern char * const __p_CType;
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. int isalnum (int c);
  41. #define isalnum(c)        ((__p_CType)[(unsigned char)(c)]&(_U|_L|_N))
  42. int isalpha (int c);
  43. #define isalpha(c)        ((__p_CType)[(unsigned char)(c)]&(_U|_L))
  44. int iscntrl (int c);
  45. #define iscntrl(c)        ((__p_CType)[(unsigned char)(c)]&_C)
  46. int isdigit (int c);
  47. #define isdigit(c)        ((__p_CType)[(unsigned char)(c)]&_N)
  48. int isgraph (int c);
  49. #define isgraph(c)        ((__p_CType)[(unsigned char)(c)]&(_P|_U|_L|_N))
  50. int islower (int c);
  51. #define islower(c)        ((__p_CType)[(unsigned char)(c)]&_L)
  52. int isprint (int c);
  53. #define isprint(c)        ((__p_CType)[(unsigned char)(c)]&(_P|_U|_L|_N|_B))
  54. int ispunct (int c);
  55. #define ispunct(c)        ((__p_CType)[(unsigned char)(c)]&_P)
  56. int isspace (int c);
  57. #define isspace(c)        ((__p_CType)[(unsigned char)(c)]&_S)
  58. int isupper (int c);
  59. #define isupper(c)        ((__p_CType)[(unsigned char)(c)]&_U)
  60. int isxdigit (int c);
  61. #define isxdigit(c)        ((__p_CType)[(unsigned char)(c)]&_X)
  62.  
  63. int tolower (int c);
  64. int toupper (int c);
  65.  
  66. /* Apple library extentions.  The prefered mechanism for enabling these is by defining
  67.  * __useAppleExts__.  In the absence of this symbol, the __STDC__ symbol is used to 
  68.  * enable or disable these extentions. */
  69.  
  70. /* CFront can't handle the pretty version of this conditional 
  71. #if defined (__useAppleExts__) || \
  72.     ((defined (applec) && ! defined (__STDC__)) || \
  73.      (defined (__PPCC__) && __STDC__ == 0))
  74. */
  75. #if defined (__useAppleExts__) || ((defined (applec) && ! defined (__STDC__)) || (defined (__PPCC__) && __STDC__ == 0))
  76.  
  77. int isascii (int c);
  78. #define isascii(c)        ( (unsigned int) (c) <= 0177)
  79.  
  80. #define __tolower(c)    ((c)-'A'+'a')
  81. #define __toupper(c)    ((c)-'a'+'A')
  82. int toascii (int c);
  83. #define toascii(c)        ((c)&0177)
  84.  
  85. #endif
  86.  
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90.  
  91. #ifdef __CFM68K__
  92.     #ifndef __SC__
  93.         #pragma pop
  94.     #else
  95.         #pragma lib_export off
  96.     #endif
  97. #endif
  98.  
  99. #endif
  100.